package ccmouse.guice.v13.helloworlddemo;

import ccmouse.guice.v13.MyAppletV7;
import com.google.inject.Provider;

import javax.inject.Inject;

public class StringWritingAppletV3 implements MyAppletV7 {

    private MyDestinationV4 destination;
    private Provider<String> stringProvider;

    @Inject
    public StringWritingAppletV3(MyDestinationV4 destination,
                                 @Output Provider<String> stringProvider) {
        this.destination = destination;
        this.stringProvider = stringProvider;
    }

    private void writeString() {
        destination.write(stringProvider.get());
    }

    @Override
    public void run() {
        writeString();
    }
}
